Skip to main content

3진법 뒤집기

Solution

function solution(n) {
return n
.toString(3)
.split("")
.reduce((acc, cur, idx) => acc + Number(cur) * 3 ** idx, 0);
}

Review

.

References